<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/views1/DTD/views1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">
	<p:dialog id="dlgBuscaQuestao" widgetVar="promptBuscaQuestao" modal="true" width="500"
		closable="false" header="Procurar Questões" minWidth="500" resizable="false">
		<h:form id="formBuscaQuestao">
			<div class="grid_12">
				<div>
					<div class="grid_2">Código: </div>
					<div class="grid_4">
						<p:inputText value="#{questaoBean.variavelBusca}" styleClass="input-pp" style="diplay: inline; float: left;"/>
					</div>
					<div class="grid_2">Assunto: </div>
					<div class="grid_4">
						<p:inputText value="#{questaoBean.varBuscaAssunto}" styleClass="input-pp" style="diplay: inline; float: left;"/>
					</div>
					<div class="grid_12">
						<p:spacer height="5px;"/>
					</div>
					<div class="grid_2">Dificuldade: </div>
					<div class="grid_10">
						<h:selectOneMenu style="width: 235px;" 
						styleClass="ui-inputfield ui-widget ui-state-default ui-corner-all" 
						value="#{questaoBean.varBuscaDificuldade}">
							<f:selectItem itemLabel="Selecione..." itemValue="#{null}"/>
							<f:selectItems value="#{enumBean.tipoGrauDificuldade}"
							var="var" itemLabel="#{var}" itemValue="#{var}"/>
						</h:selectOneMenu>
					</div>
					<div class="grid_12">
						<p:spacer height="5px;"/>
					</div>
					<div class="grid_2">Cabeçalho: </div>
					<div class="grid_10">
						<p:inputText value="#{questaoBean.varBuscaCabecalho}" style="diplay: inline; float: left;width:300px;"/>
						<ui:include src="/views/layout/ajaxStatus.xhtml"/>
						<p:commandButton update="dataTableQuestao" style="margin-top: -1px;" value="Filtrar" action="#{questaoBean.buscarQuestao}"/>
					</div>
				</div>
				<div class="grid_12">
					<p:spacer height="5px;"/>
				</div>
				<div class="grid_12">
					<p:dataTable id="dataTableQuestao"
								emptyMessage="Nenhum registro encontrado"
								paginator="true"
								lazy="true"
								dynamic="true"
								selection="#{questaoBean.questaoBaseTemp}"
								selectionMode="single"
								rows="10" paginatorPosition="top"
								value="#{questaoBean.questaoBaseList}"
								var="model"
								style="width: 475px;">
						<p:column style="width: 150px;" headerText="Código">
							<h:outputText value="#{model.codigo}"/>
						</p:column>
						<p:column headerText="Cabeçalho">
							<h:outputText escape="false" value="#{model.cabecalho}"/>
						</p:column>
					</p:dataTable>
				</div>
			</div>
			<div class="grid_12">
				<br/>
			</div>
 			<div style="text-align: right;">
           		<br/><p:separator /><br/>  
                <p:commandButton action="#{questaoBean.selecionarQuestao}" value="Selecionar" update="formPrincipal, formBuscaQuestao" onclick="promptBuscaQuestao.hide()" />
                <p:commandButton type="button" value="Desistir" onclick="promptBuscaQuestao.hide()"/>
            </div>
		</h:form>
	</p:dialog>
</f:view>